//package com.yunxitest.yunxitest.item.outScreen
//
//import android.graphics.SurfaceTexture
//import android.util.Log
//import android.view.TextureView
//import com.yunxi.streampublisher.engine.modules.Director2
//
//class SceneSurfaceRender(private val directorRender: Director2?) : TextureView.SurfaceTextureListener {
//
//    private var scene: ShareStreamRender? = null
//    private var textureId: Int? = -1
//    override fun onSurfaceTextureSizeChanged(surface: SurfaceTexture?, width: Int, height: Int) {
//        scene?.sendSurfaceChanged(width, height)
//        Log.d("SceneSurfaceRender", "onSurfaceTextureSizeChangedsurface $surface texture id : $textureId")
//    }
//
//    override fun onSurfaceTextureUpdated(surface: SurfaceTexture?) {
//
//    }
//
//    override fun onSurfaceTextureDestroyed(surface: SurfaceTexture?): Boolean {
//        Log.d("SceneSurfaceRender", "onSurfaceTextureDestroyed ！！！！surface $this texture id : $textureId")
//        scene?.sendSurfaceDestroyed()
//        scene = null
//        return true
//    }
//
//    override fun onSurfaceTextureAvailable(surface: SurfaceTexture?, width: Int, height: Int) {
//        if (scene == null) {
//            scene = directorRender?.generateShareStreamRender()
//            scene?.start()
//        }
//        scene?.setStreamTexture(textureId)
//        scene?.sendSurfaceAvailable(surface!!, width, height)
//        Log.d("ScenesSurfaceRender", "onSurfaceTextureAvailable     ##############   : ${scene!!} surface $this texture id : $textureId")
//    }
//
//    fun setStreamTexture(textureId: Int?) {
//        this.textureId = textureId
//        scene?.setStreamTexture(textureId)
//    }
//
//    fun pause() {
//        scene?.sendSurfacePause()
//    }
//
//    fun resume() {
//        scene?.sendSurfaceResume()
//    }
//}